Validate a Certificate and Generate a MAC on its Public Key

Command:

Validate a certificate and generate a MAC on the public key contained in the certificate, using LMK pair 36-37.

Notes:

This command requires the optional RSA licence, error code 67 will be returned if the command is not licenced.

The command can (optionally) check whether the public key in the certificate corresponds to a secret key encrypted under the LMK.

See: Using the RSA cryptosystem for details of where valid values of the common parameters can be found.

 

Field

Length & Type

Details

COMMAND MESSAGE

Message header

m A

(Subsequently returned to the Host unchanged).

Command code

2 A

Value ES.

MAC

4 B

MAC on the public key and authentication data, calculated using LMK pair 36-37.

Public key

n B

Public key, DER encoded in ASN.1 format (sequence of modulus, exponent).

Authentication data

n B

Optional. Additional data to be included in the MAC calculation (must not include “;”).

Delimiter

1 A

Delimiter, indicates the end of the authentication data field.  Value  “;”.

Certificate length

4 N

Certificate length (in bytes).

Hash offset

4 N

Offset to the first byte in the certificate data to be included in the hash calculation.

Hash length

4 N

Length (in bytes) of the data within the certificate which is included in the hash calculation.

Signature offset

4 N

Offset to the first byte of the signature contained in the certificate data.

Signature length

4 N

Length (in bytes) of the signature contained in the certificate data.

Certificate

n B

Certificate data to be validated.

Delimiter

1 A

Delimiter, indicates the end of the certificate field. Value  “;”.

Hash identifier

2 N

Identifier of the hash algorithm used to hash the certificate data.

Signature algorithm

2 N

Identifier of the signature algorithm used to sign the certificate data.

Pad mode identifier

2 N

Identifier of the pad mode used in certificate signature generation.

01 = PKCS#1 v1.5 method
02 = OAEP

Mask Generation Function

2N

01 = MGF1 as defined in PKCS#1 v2.0 (see Reference 3)

Optional, only present if PAD Mode Identifier is 02 (OAEP)

MGF Hash Function

2N

01 = SHA-1
This field defines the hash function to be used in the MGF. Optional, only present if Pad Mode Identifier is 02 (OAEP)

 

 

 


 

Field

Length & Type

Details

OAEP Encoding Parameters Length

2N

Optional, only present if Pad Mode Identifier is 02 (OAEP).

OAEP Encoding Parameters

  

nB

Optional, only present if Pad Mode Identifier is 02 (OAEP)

If present, this field should be encoded according to Reference 3 section 11.2.1. The HSM does not interpret or validate the contents of this field. If OAEP padding is used, but no Encoding Parameters are provided, then OAEP Parameters Length should be “00”, and this field will be empty.

OAEP Encoding Parameters Delimiter

1A

Value “;”.

Optional, only present if Pad Mode Identifier is 02 (OAEP)

Public key encoding

2 N

Encoding rules for the public key contained in the certificate (must allow the public key length to be inferred).

Public key offset

4 N

Offset to the first byte of the public key field contained in the certificate

Authentication data

n B

Optional.  Additional data to be included in the MAC calculation (must not include “;”).

Delimiter

1 A

Delimiter, indicates the end of the authentication data field. Value “;” .

Secret key length

4 N

Optional.  Length (in bytes) of the next field.  Must be present if the secret key field is present.

Secret key

n B

Optional. Secret key, encrypted under LMK pair 34-35.

End message delimiter

1 C

Optional.  Must be present if a message trailer is present. Value X’19.

Message trailer

n A

Optional.  Maximum length 32 characters.

 

 

 


 

Field

Length & Type

Details

RESPONSE MESSAGE

Message header

m A

Returned to the Host unchanged.

Response code

2 A

Value ET.

Error code

2 N

00 : No error

01 : MAC verification failure

02 : Certificate validation failure

03 : Invalid public key encoding type

04 : Public key does not conform to encoding rules

05 : Invalid hash identifier

06 : Invalid signature identifier

07 : Invalid pad mode identifier

13 : LMK error; report to supervisor

15 : Error in input data

47 : DSP error; report to supervisor

49 : Secret key error; report to supervisor

74 : Invalid digest info syntax (no-hash mode only)

75 : Invalid public key / secret key pair

76 : Public key length error

77 : Clear data block error

78 : Secret key length error

79 : Hash algorithm object identifier error

80 : Certificate length error

81 : Certificate offset and length error

85 : Invalid OAEP Mask Generation Function

86 : Invalid OAEP MGF Hash Function

87 : OAEP Parameter Error

88 : OAEP Error

MAC

4 B

MAC on the public key and authentication data, calculated using LMK pair 36-37.

Public key

n B

Public key, DER encoded in ASN. 1 format (sequence of modulus, exponent).

End message delimiter

1 C

Present only if present in the command message. Value X’19.

Message trailer

n A

Present only if present in the command message. Maximum length 32 characters.

 

Example

Command Request:

ES<CF00C78C><30650260C966B690BFA31432C3BAD853EAF4CA5592337EA2F025BEA9BCAF06DC><1

77C1919B136508E76D795E27EB70DE1FA20CD820A2A5F5BBC7834EA46B2EE35><E3C21CF9CDCA0C4

53DE6FA55EFA3A68BB166F8BA0313DCE23B02AEF0BF1CBA76><782BA44B020103>;0167000000710

0710096<30450240A1D8B0C7D2C52393825A8223C820AE0D130DE3EB8BF96819225C3848><40D788

A493B1C2E12619223070EAC7CE3A68A35C3A06796C3478E66C9B06C318><70C0F4F7020103><34CA

586F84569B47647DC88A8F8C613310EA637015E916F5D228F479462597C8><36FD5FF55BDEB7D77B

5C2BE31F8E975A8F44ED2EC6E71245BF68CA03510047CA><5C1FB6C4228CEFD8C36A772BD7EA88A3

CCFDEB0333C66C3EDE4A226F1C0BDD6D>;010102010108<1122334455667788>;010000;

Command Response:

ET00<C501FE2D><30450240A1D8B0C7D2C52393825A8223C820AE0D130DE3EB8BF96819225C38484

0D788A493B1C2E12619223070EAC7CE3A68A35C3A06796C3478E66C9B06C31870C0F4F7020103>